

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/favicon.ico">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="xuehaoweng">
  <meta name="keywords" content="">
  
    <meta name="description" content="监控系统是确保IT基础设施稳定运行的关键。Prometheus，作为一个强大的开源监控工具，通过与Consul、Blackbox Exporter和Alertmanager的结合使用，可以构建一个高效且灵活的监控告警系统。本文将详细介绍这些工具的工作原理和配置方法，以及它们在实际应用中的表现。  Consul：服务发现与注册Consul是HashiCorp公司开发的一款服务发现与配置工具，它提供">
<meta property="og:type" content="article">
<meta property="og:title" content="Prometheus部署TCP和ICMP服务探测：监控的艺术与科学">
<meta property="og:url" content="http://blog.xhweng.cn/2024/03/27/Prometheus%E9%83%A8%E7%BD%B2TCP%E5%92%8CICMP%E6%9C%8D%E5%8A%A1%E6%8E%A2%E6%B5%8B%EF%BC%9A%E7%9B%91%E6%8E%A7%E7%9A%84%E8%89%BA%E6%9C%AF%E4%B8%8E%E7%A7%91%E5%AD%A6/index.html">
<meta property="og:site_name" content="有追求的开发者">
<meta property="og:description" content="监控系统是确保IT基础设施稳定运行的关键。Prometheus，作为一个强大的开源监控工具，通过与Consul、Blackbox Exporter和Alertmanager的结合使用，可以构建一个高效且灵活的监控告警系统。本文将详细介绍这些工具的工作原理和配置方法，以及它们在实际应用中的表现。  Consul：服务发现与注册Consul是HashiCorp公司开发的一款服务发现与配置工具，它提供">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://blog.xhweng.cn/img/file_img/prometheus.jpg">
<meta property="article:published_time" content="2024-03-27T02:57:50.000Z">
<meta property="article:modified_time" content="2024-03-27T02:57:23.537Z">
<meta property="article:author" content="xuehaoweng">
<meta property="article:tag" content="监控">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="http://blog.xhweng.cn/img/file_img/prometheus.jpg">
  
  
    <meta name="referrer" content="no-referrer-when-downgrade">
  
  
  <title>Prometheus部署TCP和ICMP服务探测：监控的艺术与科学 - 有追求的开发者</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"blog.xhweng.cn","root":"/","version":"1.9.7","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"follow_dnt":true,"baidu":"b3bbb822b3d2a5e2761107c03cf72b8c","google":{"measurement_id":null},"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml","include_content_in_search":true};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  

  
    <!-- Baidu Analytics -->
    <script async>
      if (!Fluid.ctx.dnt) {
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?b3bbb822b3d2a5e2761107c03cf72b8c";
          var s = document.getElementsByTagName("script")[0];
          s.parentNode.insertBefore(hm, s);
        })();
      }
    </script>
  

  
    <!-- Google tag (gtag.js) -->
    <script async>
      if (!Fluid.ctx.dnt) {
        Fluid.utils.createScript("https://www.googletagmanager.com/gtag/js?id=", function() {
          window.dataLayer = window.dataLayer || [];
          function gtag() {
            dataLayer.push(arguments);
          }
          gtag('js', new Date());
          gtag('config', '');
        });
      }
    </script>
  

  

  

  

  



  
<meta name="generator" content="Hexo 7.0.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>有追求的开发者</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/" target="_self">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/" target="_self">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/" target="_self">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/" target="_self">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/" target="_self">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Prometheus部署TCP和ICMP服务探测：监控的艺术与科学"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2024-03-27 10:57" pubdate>
          2024年3月27日 上午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          815 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          7 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <h1 id="seo-header">Prometheus部署TCP和ICMP服务探测：监控的艺术与科学</h1>
            
            
              <div class="markdown-body">
                
                <blockquote>
<p>监控系统是确保IT基础设施稳定运行的关键。Prometheus，作为一个强大的开源监控工具，通过与Consul、Blackbox Exporter和Alertmanager的结合使用，可以构建一个高效且灵活的监控告警系统。本文将详细介绍这些工具的工作原理和配置方法，以及它们在实际应用中的表现。</p>
</blockquote>
<h2 id="Consul：服务发现与注册"><a href="#Consul：服务发现与注册" class="headerlink" title="Consul：服务发现与注册"></a>Consul：服务发现与注册</h2><p>Consul是HashiCorp公司开发的一款服务发现与配置工具，它提供了一个高可用的分布式系统，用于管理服务的注册、发现和配置。在监控场景中，Consul允许Prometheus通过服务名称来发现目标，而不需要硬编码IP地址或主机名。</p>
<h3 id="Consul作为TCP和ICMP服务注册"><a href="#Consul作为TCP和ICMP服务注册" class="headerlink" title="Consul作为TCP和ICMP服务注册"></a>Consul作为TCP和ICMP服务注册</h3><ol>
<li><strong>服务注册</strong>：应用启动时，向Consul注册其服务，包括服务名称、地址和端口等信息。</li>
<li><strong>健康检查</strong>：Consul可以执行HTTP、TCP或脚本检查，以确保服务的健康状态。</li>
<li><strong>服务发现</strong>：Prometheus通过Consul的服务发现机制，动态获取服务列表，进行监控。</li>
</ol>
<h2 id="Blackbox-Exporter：灵活的探测工具"><a href="#Blackbox-Exporter：灵活的探测工具" class="headerlink" title="Blackbox Exporter：灵活的探测工具"></a>Blackbox Exporter：灵活的探测工具</h2><p>Blackbox Exporter是一个用于监控的黑盒测试工具，它可以与Prometheus集成，执行TCP和ICMP探测，以及其他类型的网络探测。</p>
<h3 id="Blackbox-Exporter进行探测"><a href="#Blackbox-Exporter进行探测" class="headerlink" title="Blackbox Exporter进行探测"></a>Blackbox Exporter进行探测</h3><ol>
<li><strong>配置探测</strong>：在Blackbox Exporter的配置文件中定义TCP和ICMP探测的规则。</li>
<li><strong>执行探测</strong>：Blackbox Exporter根据配置，定期执行探测，并将结果以时间序列的形式暴露给Prometheus。</li>
<li><strong>结果分析</strong>：Prometheus收集这些数据，可以用于服务的可用性分析和警报触发。</li>
</ol>
<h2 id="Alertmanager：智能的告警管理"><a href="#Alertmanager：智能的告警管理" class="headerlink" title="Alertmanager：智能的告警管理"></a>Alertmanager：智能的告警管理</h2><p>Alertmanager是Prometheus的官方告警管理工具，它处理Prometheus发送的警报，并对它们进行分组、抑制、路由和通知。</p>
<h3 id="使用Alertmanager进行监控告警"><a href="#使用Alertmanager进行监控告警" class="headerlink" title="使用Alertmanager进行监控告警"></a>使用Alertmanager进行监控告警</h3><ol>
<li><strong>配置路由</strong>：在Alertmanager中定义警报路由规则，根据警报的标签和严重性将它们分发到相应的接收者。</li>
<li><strong>抑制策略</strong>：设置抑制规则，避免在问题未解决时重复发送相同的警报。</li>
<li><strong>通知发送</strong>：当警报被触发时，Alertmanager通过集成的通知渠道（如邮件、Slack、PagerDuty等）发送通知。</li>
</ol>
<h2 id="综合应用：构建完整的监控告警流程"><a href="#综合应用：构建完整的监控告警流程" class="headerlink" title="综合应用：构建完整的监控告警流程"></a>综合应用：构建完整的监控告警流程</h2><p>通过将Consul、Blackbox Exporter和Alertmanager与Prometheus结合，我们可以构建一个完整的监控告警流程：</p>
<ol>
<li><strong>服务注册与发现</strong>：应用启动时在Consul中注册服务，Prometheus通过Consul发现目标。</li>
<li><strong>探测执行</strong>：Blackbox Exporter根据配置执行TCP和ICMP探测，并将结果提供给Prometheus。</li>
<li><strong>数据分析与警报</strong>：Prometheus分析探测数据，当检测到服务不可用时，触发警报。</li>
<li><strong>告警管理</strong>：Alertmanager接收警报，根据规则进行处理，并向相关人员发送通知。</li>
</ol>
<h2 id="监控的艺术与科学的进一步解读"><a href="#监控的艺术与科学的进一步解读" class="headerlink" title="监控的艺术与科学的进一步解读"></a>监控的艺术与科学的进一步解读</h2><p>监控的艺术与科学不仅体现在技术层面的精确和严谨，还体现在对监控系统整体设计的思考。Consul、Blackbox Exporter和Alertmanager的集成使用，展示了监控系统的灵活性和可扩展性。它们共同构成了一个强大、可靠且易于管理的监控告警系统，使得监控工作既科学又具有艺术性。</p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E7%9B%91%E6%8E%A7/" class="category-chain-item">监控</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/%E7%9B%91%E6%8E%A7/" class="print-no-link">#监控</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Prometheus部署TCP和ICMP服务探测：监控的艺术与科学</div>
      <div>http://blog.xhweng.cn/2024/03/27/Prometheus部署TCP和ICMP服务探测：监控的艺术与科学/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>xuehaoweng</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2024年3月27日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2024/03/27/python_SkyWalking/" title="Python 项目微服务链路追踪监控利器：SkyWalking 全景解析与实战应用">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Python 项目微服务链路追踪监控利器：SkyWalking 全景解析与实战应用</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2024/03/27/%E4%BA%91%E5%8E%9F%E7%94%9F%E7%9B%91%E6%8E%A7%E5%85%A5%E9%97%A8%EF%BC%9A%E4%BD%BF%E7%94%A8Prometheus%E3%80%81Alertmanager%20%E5%AE%9E%E7%8E%B0Cpu%E5%92%8C%E5%86%85%E5%AD%98%E7%9A%84%E7%9B%91%E6%8E%A7%E5%91%8A%E8%AD%A6/" title="云原生监控入门：使用Prometheus、Alertmanager 实现Cpu和内存的监控告警">
                        <span class="hidden-mobile">云原生监控入门：使用Prometheus、Alertmanager 实现Cpu和内存的监控告警</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="busuanzi_container_site_pv" style="display: none">
        总访问量 
        <span id="busuanzi_value_site_pv"></span>
         次
      </span>
    
    
      <span id="busuanzi_container_site_uv" style="display: none">
        总访客数 
        <span id="busuanzi_value_site_uv"></span>
         人
      </span>
    
    
  
</div>

  
  
    <!-- 备案信息 ICP for China -->
    <div class="beian">
  <span>
    <a href="http://beian.miit.gov.cn/" target="_blank" rel="nofollow noopener">
      皖ICP备2024038809号-2
    </a>
  </span>
  
    
      <span>
        <a
          href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=12345678"
          rel="nofollow noopener"
          class="beian-police"
          target="_blank"
        >
          
            <span style="visibility: hidden; width: 0">|</span>
            <img src="/img/police_beian.png" srcset="/img/loading.gif" lazyload alt="police-icon"/>
          
          <span>京公网安备12345678号</span>
        </a>
      </span>
    
  
</div>

  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.4/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.20.1/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>

  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
